package beans;

import entities.CuotasDetalle;
import controllers.CuotasDetalleFacade;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ManagedBean(name = "cuotasDetalleController")
@ViewScoped
public class CuotasDetalleController extends AbstractController<CuotasDetalle> implements Serializable {

    @EJB
    private CuotasDetalleFacade ejbFacade;

    public CuotasDetalleController() {
        super(CuotasDetalle.class);
    }

    @PostConstruct
    public void init() {
        super.setFacade(ejbFacade);
    }

    @Override
    protected void setEmbeddableKeys() {
        this.getSelected().getCuotasDetallePK().setNroFactura(this.getSelected().getCuotasCabecera().getCuotasCabeceraPK().getNroFactura());
        this.getSelected().getCuotasDetallePK().setCodProveedor(this.getSelected().getCuotasCabecera().getCuotasCabeceraPK().getCodProveedor());
    }

    @Override
    protected void initializeEmbeddableKey() {
        this.getSelected().setCuotasDetallePK(new entities.CuotasDetallePK());
    }
}
